package jjn.round1;

/**
 * @author Jjn
 * @since 2022/10/3 22:59
 */
public class LeetCode1784_CheckOnesSegments {
    public boolean checkOnesSegment(String s) {
        if (s == null || s.length() == 0) {
            return true;
        }
        int index = 0;
        while (index < s.length() && s.charAt(index) == '1') {
            index++;
        }
        while (index < s.length() && s.charAt(index) == '0') {
            index++;
        }
        return index == s.length();
    }
}
